﻿using System.ComponentModel;

namespace OperationPlugins.Models
{
    /// <summary>
    /// Provides data for the <see cref="INotifyPropertyChanged.PropertyChanged"/> event.
    /// </summary>
    public class ModelPropertyChangedEventArgs : PropertyChangedEventArgs
    {
        private readonly object _model;
        private readonly PropertyValue _newValue;
        private readonly PropertyValue _oldValue;

        /// <summary>
        /// Initializes a new instance of the ModelPropertyChangedEventArgs class.
        /// </summary>
        /// <param name="model">The model that contains the property that changed.</param>
        /// <param name="newValue">The new value of the property that changed.</param>
        /// <param name="oldValue">The old value of the property that changed.</param>
        public ModelPropertyChangedEventArgs(object model, PropertyValue newValue, PropertyValue oldValue)
            : base(newValue.PropertyName)
        {
            _model = model;
            _newValue = newValue;
            _oldValue = oldValue;
        }

        /// <summary>
        /// Gets the model that contains the property that changed.
        /// </summary>
        public object Model { get { return _model; } }

        /// <summary>
        /// Gets the new value of the property that changed.
        /// </summary>
        public PropertyValue NewValue { get { return _newValue; } }

        /// <summary>
        /// Gets the old value of the property that changed.
        /// </summary>
        public PropertyValue OldValue { get { return _oldValue; } }

    }
}
